package com.group5.service;


import com.group5.pojo.GroupsAndEmployeesExample;
import com.group5.pojo.UserssExample;

public class SellerService {
    public GroupsAndEmployeesExample addEmpIntoGroupService(int groupNum,int oid){
        GroupsAndEmployeesExample groupsAndEmployeesExample=new GroupsAndEmployeesExample();
        groupsAndEmployeesExample.createCriteria().andGroup_numberEqualTo(groupNum).andOidEqualTo(oid);
        return groupsAndEmployeesExample;
    }

    /**
     * 提供uid,查看他是不是组长用的一个服务,这里的查询条件是 是组长
     * @param empUid
     * @return
     */
    public GroupsAndEmployeesExample uidAndGroupLeaderService( int empUid){
        GroupsAndEmployeesExample groupsAndEmployeesExample = new GroupsAndEmployeesExample();
        groupsAndEmployeesExample.createCriteria().andIs_group_leaderEqualTo(true).andUidEqualTo(empUid);
        return groupsAndEmployeesExample;
    }

    /**
     * 通过uid查询用户的组信息
     * @param uid
     * @return
     */
    public GroupsAndEmployeesExample getUserAndGroupInfoByUidService(int uid){
        GroupsAndEmployeesExample groupsAndEmployeesExample = new GroupsAndEmployeesExample();
        groupsAndEmployeesExample.createCriteria().andUidEqualTo(uid);
        return groupsAndEmployeesExample;
    }


    public UserssExample selectUserByUsernameExample(String username) {
        UserssExample userssExample=new UserssExample();
        userssExample.createCriteria().andUser_nameEqualTo(username);
        return userssExample;
    }

    public GroupsAndEmployeesExample selectGroupByGroupnumberAndOid(Integer group_number, Integer oid) {
        GroupsAndEmployeesExample groupsAndEmployeesExample=new GroupsAndEmployeesExample();
        groupsAndEmployeesExample.createCriteria().andOidEqualTo(oid).andGroup_numberEqualTo(group_number);
        return groupsAndEmployeesExample;
    }
}
